{% load helpers %}
{% load perms %}
<form method="post">
    {% csrf_token %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>{{ title }}</strong>
        </div>
        <table class="table table-hover panel-body component-list">
            {% for obj in components %}
                {% include component_template %}
            {% endfor %}
        </table>
        <div class="panel-footer noprint">
            {% if components and perms.dcim.change_consoleport %}
                <button type="submit" name="_rename" formaction="{% url 'dcim:consoleport_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
                    <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
                </button>
                <button type="submit" name="_edit" formaction="{% url 'dcim:consoleport_bulk_edit' %}?device={{ device.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
                    <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
                </button>
                <button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleport_bulk_disconnect' %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
                    <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
                </button>
            {% endif %}
            {% if components and perms.dcim.delete_consoleport %}
                <button type="submit" name="_delete" formaction="{% url 'dcim:consoleport_bulk_delete' %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
                    <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
                </button>
            {% endif %}
            {% if components and perms.dcim.add_consoleport %}
                <div class="pull-right">
                    <a href="{% url 'dcim:consoleport_add' %}?device={{ device.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-xs btn-primary">
                        <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add console port
                    </a>
                </div>
            {% endif %}
        </div>
    </div>
</form>
